ms_files := $(shell find . -name "*.ms")
macros := ./resources/macros.tmac
tmp := $(shell mktemp)

notes.pdf: $(macros) $(ms_files)
	echo ".so $(macros)" >>$(tmp)
	for f in $(ms_files) ; do\
		cat $$f >>$(tmp);\
		echo '.bp' >>$(tmp) ;\
	done
	head -n -1 $(tmp) | tmaconv | groff -k -ms -Tpdf > notes.pdf
	rm $(tmp)

clean:
	rm -f notes.pdf
